from selenium import webdriver
from time import sleep
import os
option = webdriver.ChromeOptions()
path = os.path.abspath('images')
prefs = {
    'profile.default_content_settings.popups': 0,  # 取消弹窗
    'download.default_directory': path  # 设置保存位置
}

option.add_experimental_option('prefs', prefs)

driver = webdriver.Chrome(options=option)
driver.get('https://pypi.org/project/requests/#files')

element = driver.find_element_by_partial_link_text('requests-2.28.1.tar.gz')
element.click()